#include "specular.h"

#include "vector3.h"
#include <cmath>

namespace raytrace {

Specular::Specular(Vector3Arg reflectance_color, Vector3Arg emittance_color)
  : Material(reflectance_color, emittance_color) {
}
  
void Specular::GetOutDirection(Vector3Arg in, Vector3Arg normal, uint32_t depth,
                               std::vector<float>& ipdfs,
                               std::vector<Vector3>& outs) const {
  Vector3 reflectDir = Vector3::sub(in, 
                                Vector3::scale(normal,
                                               2 * Vector3::dot(in, normal))); 
	reflectDir.normalize();
	
	outs.push_back(reflectDir);
	ipdfs.push_back(2 * M_PI);
}                                      

}
